From 14ecb6faa44e0b9b5d92360e0d3a1bdac84d8733 Mon Sep 17 00:00:00 2001 From: "awilliam@ldap.hp.com" Date: Tue, 25 Apr 2006 13:11:15 -0600 Subject: [PATCH] [IA64] introduce efi_memmap_walk_type introduce efi_memmap_walk_type() for the next dom0 builder patch. Signed-off-by: Isaku Yamahata --- xen/arch/ia64/linux-xen/efi.c | 21 +++++++++++++++++++++ xen/include/asm-ia64/linux-xen/linux/efi.h | 4 ++++ 2 files changed, 25 insertions(+) diff --git a/xen/arch/ia64/linux-xen/efi.c b/xen/arch/ia64/linux-xen/efi.c index 96be4b9890..488e372e1c 100644 --- a/xen/arch/ia64/linux-xen/efi.c +++ b/xen/arch/ia64/linux-xen/efi.c @@ -455,6 +455,27 @@ efi_memmap_walk_uc (efi_freemem_callback_t callback) } } +#ifdef XEN +void +efi_memmap_walk_type(u32 type, efi_walk_type_callback_t callback, void *arg) +{ + void *efi_map_start, *efi_map_end, *p; + efi_memory_desc_t *md; + u64 efi_desc_size; + + efi_map_start = __va(ia64_boot_param->efi_memmap); + efi_map_end = efi_map_start + ia64_boot_param->efi_memmap_size; + efi_desc_size = ia64_boot_param->efi_memdesc_size; + + for (p = efi_map_start; p < efi_map_end; p += efi_desc_size) { + md = p; + if (md->type == type) { + if ((*callback)(md, arg) < 0) + return; + } + } +} +#endif /* * Look for the PAL_CODE region reported by EFI and maps it using an diff --git a/xen/include/asm-ia64/linux-xen/linux/efi.h b/xen/include/asm-ia64/linux-xen/linux/efi.h index 73781ec165..6ec3c93990 100644 --- a/xen/include/asm-ia64/linux-xen/linux/efi.h +++ b/xen/include/asm-ia64/linux-xen/linux/efi.h @@ -293,6 +293,10 @@ extern void *efi_get_pal_addr (void); extern void efi_map_pal_code (void); extern void efi_map_memmap(void); extern void efi_memmap_walk (efi_freemem_callback_t callback, void *arg); +#ifdef XEN +typedef int (*efi_walk_type_callback_t)(efi_memory_desc_t *md, void *arg); +extern void efi_memmap_walk_type(u32 type, efi_walk_type_callback_t callback, void *arg); +#endif extern void efi_gettimeofday (struct timespec *ts); extern void efi_enter_virtual_mode (void); /* switch EFI to virtual mode, if possible */ extern u64 efi_get_iobase (void); -- 2.30.2